//+======================================================================
// $Source: /disk/cvs//TANGO/DeviceServer/JClock/DSClockClass.java,v $
//
// Project:   	Tango Device Server
//
// Description:	java source code for the DSClock class .
//              This class is a singleton class and implements everything
//              which exists only once for all the  DSClock object
//              It inherits from the DeviceClass class.
//
// $Author: raph $
//
// $Revision: 1.1.1.1 $
//
// $Log: DSClockClass.java,v $
// Revision 1.1.1.1  2001/04/17 11:21:05  raph
// initial work
//
//
// copyleft :    European Synchrotron Radiation Facility
//               BP 220, Grenoble 38043
//               FRANCE
//
//-======================================================================
//
//  		This file is generated by POGO
//	(Program Obviously used to Generate tango Object)
//
//             (c) - Pascal Verdier - ESRF
//=============================================================================


import java.util.*;
import org.omg.CORBA.*;
import Tango.*;
import TangoDs.*;

public class DSClockClass extends DeviceClass implements TangoConst
{
	private static DSClockClass	_instance = null;

	//+---------------------------------------------------------------------
	//
	// method : 		instance()
	// 
	// description : 	static method to retrieve the DSClockClass object 
	//					once it has been initialised
	//
	//----------------------------------------------------------------------
	public static DSClockClass instance()
	{
		if (_instance == null)
		{
			System.err.println("DSClockClass is not initialised !!!");
			System.err.println("Exiting");
			System.exit(-1);
		}
		return _instance;
	}

	//+---------------------------------------------------------------------
	//
	// method : 		Init()
	// 
	// description : 	static method to create/retrieve the DSClockClass
	//					object. This method is the only one which enables a 
	//					user to create the object
	//
	// in :			- class_name : The class name
	//
	//----------------------------------------------------------------------
	public static DSClockClass init(String class_name) throws DevFailed
	{
		if (_instance == null)
		{
			_instance = new DSClockClass(class_name);
		}
		return _instance;
	}
	
	//+---------------------------------------------------------------------
	//
	// method : 		DSClockClass()
	// 
	// description : 	constructor for the DSClockClass class
	//
	// argument : in : 	- name : The class name
	//
	//----------------------------------------------------------------------
	protected DSClockClass(String name) throws DevFailed
	{
		super(name);

		TangoUtil.out2.println("Entering DSClockClass constructor");
	
		TangoUtil.out2.println("Leaving DSClockClass constructor");
	}
	
	//+---------------------------------------------------------------------
	//
	// method : 		command_factory()
	// 
	// description : 	Create the command object(s) and store them in the
	//					command list
	//----------------------------------------------------------------------
	public void command_factory()
	{
		command_list.addElement(new getTimeDateCmd("getTimeDate",
			Tango_DEV_VOID, Tango_DEV_STRING,
			"",
			""));
		command_list.addElement(new setDateTimeCmd("setDateTime",
			Tango_DEV_STRING, Tango_DEV_VOID,
			"",
			""));
	}


	//+---------------------------------------------------------------------
	//
	// method : 		device_factory()
	// 
	// description : 	Create the device object(s) and store them in the 
	//					device list
	//
	// argument : in : 	String[] devlist : The device name list
	//
	//----------------------------------------------------------------------
	public void device_factory(String[] devlist) throws DevFailed
	{
	
		for (int i=0 ; i<devlist.length ; i++)
		{
			TangoUtil.out4.println("Device name : " + devlist[i]);
						
			// Create device and add it into the device list
			//----------------------------------------------
			device_list.addElement(new DSClock(this, devlist[i]));

			// Export device to the outside world
			//----------------------------------------------
			export_device(((DeviceImpl)(device_list.elementAt(i))));
		}
	}

	//+----------------------------------------------------------------------------
	//	Method:	 attribute_factory
	//-----------------------------------------------------------------------------
	public void attribute_factory(Vector att_names)
	{
		att_names.addElement("Seconde");
	}
}